import { createRouter, createWebHistory } from 'vue-router'
//通用路由
export const basicRouters = [
  {
    name: 'login',
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录',
    },
  },
  {
    name: '404',
    path: '/404',
    component: () => import('@/views/404.vue'),
    meta: {
      title: '404',
    },
  },
]
//权限路由  由后台返回菜单动态添加
export const asyncRouters = [
  {
    path: '/employeeInfo',
    component: () => import('../views/employeeInfo/index.vue'),
    name: 'employeeInfo',
    meta: {
      title: '员工资料',
    },
  },
  {
    path: '/canteenManage',
    name: 'canteenManage',
    meta: {
      title: '食堂组织',
    },
    component: () => import('../views/canteenManage/index.vue'),
  },
  {
    path: '/equipmentInfo',
    name: 'equipmentInfo',
    meta: {
      title: '设备信息',
    },
    component: () => import('../views/equipmentInfo/index.vue'),
  },
  {
    path: '/consumptionPeriod',
    name: 'consumptionPeriod',
    meta: {
      title: '消费时段',
    },
    component: () => import('../views/consumptionPeriod/index.vue'),
  },
  {
    path: '/consumptionLevel',
    name: 'consumptionLevel',
    meta: {
      title: '消费等级',
    },
    component: () => import('../views/consumptionLevel/index.vue'),
  },
  {
    path: '/dataAcquisition',
    name: 'dataAcquisition',
    meta: {
      title: '数据采集',
    },
    component: () => import('../views/dataAcquisition/index.vue'),
  },
  {
    path: '/subsidyManage',
    name: 'subsidyManage',
    meta: {
      title: '补贴管理',
    },
    component: () => import('../views/subsidyManage/index.vue'),
  },
  {
    path: '/consumptionReport',
    name: 'consumptionReport',
    meta: {
      title: '消费报表',
    },
    component: () => import('../views/consumptionReport/index.vue'),
  },
  {
    path: '/consumptionPosting',
    name: 'consumptionPosting',
    meta: {
      title: '消费过账',
    },
    component: () => import('../views/consumptionPosting/index.vue'),
  },
  {
    path: '/roleManage',
    name: '角色管理',
    meta: {
      title: '角色管理',
    },
    component: () => import('../views/accessManage/roleManage.vue'),
  },
  {
    path: '/userManage',
    name: '用户管理',
    meta: {
      title: '用户管理',
    },
    component: () => import('../views/accessManage/userManage.vue'),
  },
  {
    path: '/menuManage',
    name: '菜单管理',
    meta: {
      title: '菜单管理',
    },
    component: () => import('../views/accessManage/menuManage.vue'),
  },
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: basicRouters,
})
export default router
